﻿using System;

namespace Tree
{
    abstract class Node : IDisposable
    {
        //public virtual double Calc() {}

        /// <summary>
        /// To use this it MUST be overridden in a derived class
        /// </summary>
        public virtual double Result { get { return Result; } }
       /// <summary>
       /// Flag for symbolic variables, which only are allowed to be assigned 
       /// using left handed notation - x = 1
       /// </summary>
       /// <returns></returns>
        public virtual bool IsLvalue() { return false; }
        public virtual void Assign(double value){}
        public virtual void Dispose()
        {
            Dispose(true);
            GC.SuppressFinalize(this);
        }
        protected virtual void Dispose(bool disposing)
        {
            if (!_disposed)
            {
                if (disposing)
                {
                    //disposed managed resource

                }
                // release unmanaged resource
            }
            _disposed = true;

            // if available, call to base class
            // base.Dispose(disposing);
        }


        protected bool _disposed = false;
    }
}